package com.meisiabc.app.repository.db.constant;

import lombok.Getter;
import lombok.ToString;

@Getter
@ToString
public enum OrderStatus {
    to_pay(1, "待支付"),
    payed(2, "已支付"),
    cancel_pay(3, "已取消");

    private int code;
    private String desc;

    OrderStatus(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static OrderStatus valueOf(int code) {
        OrderStatus[] items = OrderStatus.values();

        for (OrderStatus item : items) {
            if (item.getCode() == code) {
                return item;
            }
        }

        return null;
    }
}
